Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding showRewardVideoAd() arguments to README #643

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Adding showRewardVideoAd() arguments to README #643

wants to merge 1 commit into from

Conversation

tlhunter
Copy link

Currently it's impossible to know the arguments to showRewardVideoAd without looking at the code.

Currently it's impossible to know the arguments to showRewardVideoAd without looking at the code.
@tlhunter
Copy link
Author

On second thought, these two methods are misleading. They don't actually fire based on whether a reward video is played or not. Ideally the showRewardVideoAd() API would change to accept two callbacks, one which fires when the user completes the reward operation, the other which fires if the user cancels.

There are some global events which this module will fire, but it's not easy to correlate them to a particular reward ad being played. It's also not 100% possible to correctly know if a user has earned a reward with those global events. For example, the onAdDismiss event will fire if a user dismisses a reward ad. But, it will also fire if the user successfully finishes the reward ad and then closes the video to return to the game.

I don't think this PR should be accepted, but I would like to have it trigger a discussion on updating the cordova-admob-pro API.

@erperejildo
Copy link

Is this related with the error that I'm getting now when I build my app?

BUILD FAILED in 3s
27 actionable tasks: 1 executed, 26 up-to-date
(node:29640) UnhandledPromiseRejectionWarning: Error: /Users/danielrodriguez/Desktop/repositories/party-words/platforms/android/gradlew: Command failed with exit code 1 Error output:
/Users/danielrodriguez/Desktop/repositories/party-words/platforms/android/app/src/main/java/com/rjfun/cordova/admob/AdMobPlugin.java:646: error: AdMobPlugin.RewardVideoListener is not abstract and does not override abstract method onRewardedVideoCompleted() in RewardedVideoAdListener
private class RewardVideoListener implements RewardedVideoAdListener {
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileReleaseJavaWithJavac'.

Compilation failed; see the compiler error output for details.

@floatinghotpot
Copy link
Owner

floatinghotpot commented Mar 21, 2018

Fixed in 3229136

New version of AdMob Android SDK added a virtual API, just implement:

    //@Override
    public void onRewardedVideoCompleted() {
      fireAdEvent(EVENT_AD_WILLDISMISS, ADTYPE_REWARDVIDEO);
    }

@erperejildo
Copy link

Thanks

@Ices-Eyes
Copy link

Ices-Eyes commented Mar 24, 2018

It seems that there is still some problems with this... Compiling on phonegap build returns

:app:compileReleaseJavaWithJavac/app/src/main/java/com/rjfun/cordova/admob/AdMobPlugin.java:684: error: method does not override or implement a method from a supertype

@floatinghotpot
Copy link
Owner

Please use the latest version, [email protected]

@Ices-Eyes
Copy link

Hi. Pgb is retrieving the version from npm, and is already using that version. Looking at the error line on the code I see that on 2.31.3 you changed line 679 of AdMobPlugin.java, while now the the error is on line 684. I suppose the same problem is on another method than that you fixed.

@floatinghotpot
Copy link
Owner

@Ices-Eyes yes, you are correct. I made a stupid mistake, comment out the wrong line in a hurry. Should be line 684.

Now updated as [email protected].

@Ices-Eyes
Copy link

Thanks, will try it in a few moments with pgb :)

@Ices-Eyes
Copy link

It works perfectly now- Thanks! 👍

@Cycododge
Copy link

Cycododge commented Mar 25, 2018

With version 2.31.4, I am still getting the error that @erperejildo was receiving.

.../rjfun/cordova/admob/AdMobPlugin.java:646: error: AdMobPlugin.RewardVideoListener is not abstract and does not override abstract method onRewardedVideoCompleted() in RewardedVideoAdListener
private class RewardVideoListener implements RewardedVideoAdListener {

I am running cordova v8.0.0 and cordova-android v7.1.0

@floatinghotpot
Copy link
Owner

@Cycododge as the AdMob SDK API is not compatible to old version, currently you may need find the code:
https://github.com/floatinghotpot/cordova-admob-pro/blob/master/src/android/AdMobPlugin.java#L684

    //@Override
    public void onRewardedVideoCompleted() {
      fireAdEvent(EVENT_AD_WILLDISMISS, ADTYPE_REWARDVIDEO);
    }

and remove the // manually.

@Cycododge
Copy link

I'm not sure I follow. npm outdated shows that I have the latest versions.

@Cycododge
Copy link

Cycododge commented Mar 28, 2018

Removing my platforms and plugins folders, and installing clean fixed this issue.

@Terangs-K
Copy link

Terangs-K commented Apr 4, 2018

In my app when I call AdMob.prepareRewardVideoAd then always out the message 'error:3, reason: No fill, adNetwork:AdMob, adType:rewardvideo,adEvent:onAdFailLoad. Example source too. Is it OK? (My plugin version is 2.31.4) - I tested in new project but it works same...... OTL

@Slavezax
Copy link

@floatinghotpot on 2.31.4 it's with //

   //@Override
    public void onRewardedVideoCompleted() {
      fireAdEvent(EVENT_AD_WILLDISMISS, ADTYPE_REWARDVIDEO);
    }

Should we remove it manually?

@floatinghotpot
Copy link
Owner

floatinghotpot commented Apr 23, 2018

It depends.
The public void onRewardedVideoCompleted() is newly introduced in latest google play library.
If you are working with most latest google play library, @OverRide should work. You can remove the comment //.
But it will cause build error with old google play library, for example, in PhoneGap build service. So comment out @OverRide is safe to get both old and new library compatible.

@swapnilraja1212
Copy link

Fixed in 3229136

New version of AdMob Android SDK added a virtual API, just implement:

    //@Override
    public void onRewardedVideoCompleted() {
      fireAdEvent(EVENT_AD_WILLDISMISS, ADTYPE_REWARDVIDEO);
    }

How to implement ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants